package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    IFollowService followService;
    //关注或取关
    @PutMapping("/{id}/{isFollow}")
    public Result Follow(@PathVariable("id") Long followUserId,@PathVariable("isFollow") Boolean isFollow){
       return followService.Follow( followUserId,isFollow);

    }

    //查询是否关注
    @GetMapping("/or/not/{id}")
    public Result queryFollow(@PathVariable("id") Long id){
       return followService.isFollow(id);
    }

    @GetMapping("/common/{id}")
    public Result queryCommon(@PathVariable("id") Long id){
        return followService.queryCommon(id);

    }
}
